<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.openflashchart.Graph"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.ejoysoft.wlanyz.business.WarnAppear"%>
<%@ include file="../include/jsp/head.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>线图</title>
</head>
<body>
<%
     //String  type =  ParamUtil.getString(request,"type","td");
     String  strStartTime = ParamUtil.getString(request,"strStartTime","");
     String  strEndTime = ParamUtil.getString(request,"strEndTime","");
     String strCity = globa.city;
    String twhere = " where 1 = 1 and a.strnettype= 'TD' ";
    if(!strCity.equals("")){
    twhere+=" and a.strcity LIKE '%"+ strCity +"%' ";
    }
    if(strStartTime.equals(""))strStartTime = "1000-1-01";
    if(strEndTime.equals(""))strEndTime = "9999-12-30";
    twhere+="and b.dtcreatdate between to_date('" + strStartTime + "','yyyy-MM-dd hh24.mi.ss') and to_date('" + strEndTime + "','yyyy-MM-dd hh24.mi.ss')";
   // System.out.println(twhere+"}}}}}}}}}}}}}}}}td"+strStartTime+strEndTime+"================="+strCity);
    WarnAppear obj = new WarnAppear(globa);
    ArrayList<String> warnList = obj.getIndicatorName(twhere);//所有指标
    ArrayList<String> testTime = obj.getTestTime(twhere);//测试时间
   //System.out.println(twhere+"}}}}}}}}}}}}}}}}");
	ArrayList<ArrayList<String>> Data = new ArrayList<ArrayList<String>>();
	int nummax = 0;
	for(int i = 0;i < warnList.size(); i ++){
	 // System.out.println(warnList.get(i)+"}}}}}}}}}}}}}}}}");
	ArrayList<String> data = new ArrayList<String>();
	Data.add(data);
	
	//Data.get(i)代表指标所表示的折线
	for(int j = 0; j < testTime.size(); j++) {
	//System.out.println(testTime.get(j)+"]]]]]]]]]]]]]]]]");
	if(nummax<obj.getWarnNum(testTime.get(j),warnList.get(i))){
	nummax = obj.getWarnNum(testTime.get(j),warnList.get(i));
	}
	Data.get(i).add(Integer.toString(obj.getWarnNum(testTime.get(j),warnList.get(i))));//拿到对应时间的对应指标个数
	//System.out.println(Integer.toString(obj.getWarnNum(testTime.get(j),warnList.get(i)))+"==================="+nummax);
	}
	}
	Graph g = new Graph();

	// Spoon sales, March 2007
	g.title("预警呈现统计图", "{font-size: 25px;}");
	String color[] = new String[19];
	color[0]="#FFC0CB";//粉红
	color[1]="#DDA0DD";//李子紫
	color[2]="#6A5ACD ";//板岩蓝
	color[3]="#0000FF ";//纯蓝
	color[4]="#B0C4DE ";//亮钢蓝
	color[5]="#87CEEB ";//天蓝色
	color[6]="#B0E0E6 ";//火药青
	color[7]="#AFEEEE";//弱绿宝石
	color[8]="#00FA9A ";//中春绿色
	color[9]="#F0FFF0";//蜜瓜色
	color[10]="#228B22 ";//森林绿 
	color[11]="#FAFAD2 ";//亮菊黄
	color[12]="#FFD700 ";//金色
	color[13]="#FFA500 ";//橙色
	color[14]="#FF6347 ";//番茄红
	color[15]="#A52A2A ";//棕色
	color[16]="#000000 ";//纯黑
	color[17]="#8B0000 ";//深红色
	color[18]="#006400 ";//暗绿色
	for(int i = 0; i < warnList.size(); i++) {
	g.set_data(Data.get(i));//为指标添加折线
	g.line(2, color[i], warnList.get(i), 15, 2);//线宽度，颜色，text，字体大小，circle
	}
	
	//g.line_hollow("2", "4", "0x80a033", "第二条", "15");//线宽度，点大小，颜色，text，字体大小
	//g.line_dot("5", "5", "0x006699","第三条","15");//宽度，点大小，颜色，text，字体大小

	//g.set_links(links);
	
	// label each point with its value
	List<String> labels = new ArrayList<String>();
	for(int i = 0; i < testTime.size(); i++) {
	labels.add(testTime.get(i));
	//System.out.println(testTime.get(i)+"]]]]]]]]]]]]]]]]");
	}
	g.set_x_labels(labels);
	g.set_x_label_style("12", "#FF0000", 0, 0, "");//大小，颜色，，步长，方格颜色
	g.set_x_legend("指标告警", 20, "#736AFF");//text,字体大小，字体颜色
	
	//set the Y max
	g.set_y_max(((int)nummax/10+1)*10);
	// label every 20 (0,20,40,60)
	g.y_label_steps(1);
%>
<%=g.render()%>
</body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>